package pub.tbc.api.config;


import pub.tbc.toolkit.core.EmptyUtil;

import java.util.List;

/**
 * 项目通用配置
 *
 * @author tbc on 2017/3/2.
 */
public class ProjectConfig {
    private Config config = ConfigProvider.getPropertiesConfig();

    private static ProjectConfig instance = new ProjectConfig();

    public static ProjectConfig instance() {
        if (instance == null) {
            // TODO ...
        }
        return instance;
    }

    public boolean printBanner() {
        return config.getBoolean("banner.print", true);
    }

    public String httpHost() {
        return config.get("http.host");
    }

    public int httpPort() {
        return config.getInt("http.port");
    }

    public String invokerType() {
        String value = config.get("invoker.type");
        return EmptyUtil.isEmpty(value) ? DefaultConfig.INVOKER_TYPE : value;
    }

    public String heartbeatUri() {
        return config.get("heartbeat.uri");
    }

    public String heartbeatResMsg() {
        return config.get("heartbeat.res.msg");
    }

    public List<String> handlers() {
        return config.getList("handlers");
    }


}
